using System.Collections.Generic;

public class ChessBing : BaseChess
{
    public ChessBing(int camp, int team) : base(camp, team)
    {

    }
    public override void AddSomePosIntoList(BaseChessBoard chessBoard, List<Pos> tempPosList)
    {
        if (!(chessBoard is StandardChessBoard))
        {
            return;
        }
        BaseGrid grid = chessBoard.GetGridByChess(this);
        if (grid != null)
        {
            Pos chessPos = grid.GetPos();
            Pos forwardPos = chessPos.AddResult(((StandardChessBoard)chessBoard).GetForwardDirectionByCamp(GetCamp()));
            if (chessBoard.SpaceIsGridAndNotExistChess(forwardPos) || chessBoard.SpaceIsGridAndExistOtherTeamChess(forwardPos, GetTeam()))
            {
                tempPosList.Add(forwardPos);
            }
            StandardGrid sGrid = grid as StandardGrid;
            if (sGrid != null && GetCamp() != sGrid.GetCamp())
            {
                Pos orientation1Pos = chessPos.AddResult(((StandardChessBoard)chessBoard).GetOrientation1DirectionByCamp(GetCamp()));
                if (chessBoard.SpaceIsGridAndNotExistChess(orientation1Pos) || chessBoard.SpaceIsGridAndExistOtherTeamChess(orientation1Pos, GetTeam()))
                {
                    tempPosList.Add(orientation1Pos);
                }
                Pos orientation2Pos = chessPos.AddResult(((StandardChessBoard)chessBoard).GetOrientation2DirectionByCamp(GetCamp()));
                if (chessBoard.SpaceIsGridAndNotExistChess(orientation2Pos) || chessBoard.SpaceIsGridAndExistOtherTeamChess(orientation2Pos, GetTeam()))
                {
                    tempPosList.Add(orientation2Pos);
                }
            }
        }
    }

    public override Score GetScore(BaseChessBoard baseChessBoard)
    {
        StandardChessBoard sChessBoard = baseChessBoard as StandardChessBoard;
        if (sChessBoard == null)
        {
            return new Score(0, 0);
        }
        else
        {
            StandardGrid grid = (StandardGrid)(sChessBoard.GetGridByChess(this));
            if (grid.GetCamp() == GetCamp())
            {
                return new Score(2, 0);
            }
            else
            {
                return new Score(4, 0);
            }
        }
    }
}
